package com.luhuiguo.cms.shared.event;

import com.google.gwt.event.shared.GwtEvent;
import com.luhuiguo.cms.shared.model.ChannelModel;
import com.luhuiguo.cms.shared.model.ChannelTreeModel;

public class ChannelCreatedEvent extends GwtEvent<ChannelCreatedEventHandler> {

    public static Type<ChannelCreatedEventHandler> TYPE = new Type<ChannelCreatedEventHandler>();

    private final ChannelTreeModel channelTreeModel;

    private final ChannelModel channelModel;

    public ChannelCreatedEvent(ChannelModel channelModel, ChannelTreeModel channelTreeModel) {
        this.channelModel = channelModel;
        this.channelTreeModel = channelTreeModel;

    }

    public ChannelTreeModel getChannelTreeModel() {
        return channelTreeModel;
    }

    public ChannelModel getChannelModel() {
        return channelModel;
    }

    @Override
    public Type<ChannelCreatedEventHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(ChannelCreatedEventHandler handler) {
        handler.onChannelCreated(this);
    }
}
